/**
 * 
 */
package fr.fermeManager.application.beans;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import fr.fermeManager.library.model.beans.Transaction;
import fr.fermeManager.library.model.beans.TypeTransaction;

/**
 * @author Mo
 *
 */
public class BeanTransaction {
	
	private Transaction transaction;
	
	private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
	
	public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

	/**
	 * @param typeTransaction
	 * @see fr.fermeManager.library.model.beans.Transaction#setTypeTransaction(fr.fermeManager.library.model.beans.TypeTransaction)
	 */
	public void setTypeTransaction(TypeTransaction typeTransaction) {
		TypeTransaction oldVal = transaction.getTypeTransaction();
		changeSupport.firePropertyChange("typeTransaction", oldVal, typeTransaction);
		transaction.setTypeTransaction(typeTransaction);
	}

	/**
	 * @param id
	 * @see fr.fermeManager.library.model.beans.Transaction#setId(int)
	 */
	public void setId(int id) {
		int oldVal = transaction.getId();
		changeSupport.firePropertyChange("id", oldVal, id);
		transaction.setId(id);
	}

	/**
	 * @param actif
	 * @see fr.fermeManager.library.model.beans.Transaction#setActif(boolean)
	 */
	public void setActif(boolean actif) {
		boolean oldVal = transaction.isActif();
		changeSupport.firePropertyChange("actif", oldVal, actif);
		transaction.setActif(actif);
	}

	/**
	 * @param montant
	 * @see fr.fermeManager.library.model.beans.Transaction#setMontant(float)
	 */
	public void setMontant(float montant) {
		float oldVal = transaction.getMontant();
		changeSupport.firePropertyChange("montant", oldVal, montant);
		transaction.setMontant(montant);
	}

	/**
	 * @param libelle
	 * @see fr.fermeManager.library.model.beans.Transaction#setLibelle(java.lang.String)
	 */
	public void setLibelle(String libelle) {
		String oldVal = transaction.getLibelle();
		changeSupport.firePropertyChange("libelle", oldVal, libelle);
		transaction.setLibelle(libelle);
	}

	/**
	 * @param descritption
	 * @see fr.fermeManager.library.model.beans.Transaction#setDescritption(java.lang.String)
	 */
	public void setDescritption(String descritption) {
		String oldVal = transaction.getDescritption();
		changeSupport.firePropertyChange("descritption", oldVal, descritption);
		transaction.setDescritption(descritption);
	}

}
